class Hook:

    def __init__(self, name, stage=('train', 'val')):
        self.name = name
        self.stage = stage

    def log(self, message, container):
        logs = container.get_extra("log." + self.name)
        logs.append(message)
        container.put_extra("log." + self.name, logs)


class BeforeRunHook(Hook):

    def before_run(self, container):
        pass


class AfterRunHook(Hook):

    def after_run(self, container):
        pass


class BeforeEpochHook(Hook):

    def before_epoch(self, container):
        pass


class AfterEpochHook(Hook):

    def after_epoch(self, container):
        pass


class BeforeIterHook(Hook):

    def before_iter(self, container):
        pass


class AfterIterHook(Hook):

    def after_iter(self, container):
        pass
